#include <iostream>

using namespace std;

namespace
{
    void func();
    extern int x;
}

namespace
{
    void func3();
}

namespace nv1
{
    int x = 10;

    void func()
    {
        cout << "nv1::func" << endl;
        ::func();
        cout << "anonymous::x: " << ::x << endl;
    }
}

namespace nv2
{
    int x = 20;

    void func()
    {
        cout << "nv2::func" << endl;
        ::func3();
    }
}

namespace
{
    int x = 1;

    void func()
    {
        cout << "anonymous::func" << endl;
    }
}

int main()
{
    std::cout << ::x << std::endl;
    std::cout << nv1::x << std::endl;
    std::cout << nv2::x << std::endl;
    nv1::func();
    nv2::func();
}